/**
 * Field class
 * the basic unit of witch the board is made of
 * contains tile or nothing
 * and special properties i.e bonus points
 * should contain as well its display info ??? i.e how to display special properties etc.
 * @author kkopiec
 *
 */
public class Field {
	protected Tile tile;
	//TODO: rethink field properties organisation
	protected FieldProps propType;
	
	protected int propValue = 1;
	protected boolean tiled = false;
	public Field(FieldProps propType, int propValue){
		this.propType = propType;
		this.propValue = propValue;
	}
	public Field(Field f){
		this.propValue = f.propValue;
		this.propType = f.propType;
		this.tiled = f.tiled;
		if (f.tiled)
		this.tile = new Tile(f.tile);
	}
	public void setTile(Tile tile) {
		this.tile = tile;
		tiled = true;
		
	}
	public String toString(){
		String tmp = "";
		switch (propType){
		case WORD:
			tmp = tmp + "w";
			break;
		case LETTER:
			tmp = tmp + "l";
			break;
		case NONE:
			tmp = tmp + " ";
			break;
		}
		if ( tiled == true){
			tmp = tmp + tile.getLetter();
		} else tmp = tmp + " ";
		if (propType == FieldProps.NONE) tmp = tmp + " ";
		else tmp = tmp + propValue;
		return tmp;
	}
	public char getLetter(){
		return tile.getLetter();
	}
	public int getPropValue(){
		return propValue;
	}
	public FieldProps getPropType(){
		return propType;
	}
	public int getTileValue(){
		return tile.getValue();
	}
	public void setPropType(FieldProps propType) {
		this.propType = propType;
	}
	public void setPropValue(int propValue) {
		this.propValue = propValue;
	}
	public void clearProps(){
		this.propType = FieldProps.NONE;
		this.propValue = 0;
	}
}
